package com.atguigu.lease.common.context;

/**
 * @ClassName LoginUserContext
 * @Author 波
 * @Date 2024/7/1 18:42
 */
public class LoginUserContext {
    private static final ThreadLocal<LoginUser> userThreadLocal = new ThreadLocal<>();

    public static void setLoginUser(LoginUser loginUser) {
        userThreadLocal.set(loginUser);
    }

    public static LoginUser getLoginUser() {
        return userThreadLocal.get();
    }

    public static void clear() {
        userThreadLocal.remove();
    }
}
